home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacFormat España 15
/
macformat_15.iso
/
Shareware Internet
/
Ciencia
/
CFG 2.3 (Shareware)
/
µCinema Converter
/
pstring.c
< prev
next >
Wrap
Text File
|
1994-04-10
|
2KB
|
82 lines
/********************************************************************
µCinema Converter 1.0
module: pstring.c
October 1991 - April 1994
by John A. Schlack
*********************************************************************************/
#include "pstring.h"
#define TOUPPER(c) ((short) ((((c)>='a') && ((c)<='z')) ? ((c)-32) : (c)))
/* -------------------------------------------------------------------------------- */
unsigned char * pstrcpy( unsigned char * dest, unsigned char * src )
{
register short i = *src, j;
unsigned char * ret = dest;
for (j=0; j<=i; j++) /* must include size byte, so has equal sign */
*dest++ = *src++;
return dest;
}
/* -------------------------------------------------------------------------------- */
void pstrsub( unsigned char * base, unsigned char * sub )
{
Str255 temp;
short i, j, k, len, slen;
/* locate instance of # character */
len = (short) base[0];
for (i=1; i<=len; i++)
if (base[i] == '#')
break;
if (i > len) return;
/* save a copy of current string */
pstrcpy( temp, base );
k = i + 1; /* save location to copy rest of original string */
slen = (short) sub[0];
for (j=1; (i<=255) && (j<=slen); i++, j++)
base[i] = sub[j];
/* copy remainder of original string */
for (; (i<=255) && (k<=len); i++, k++)
base[i] = temp[k];
if (i > 0) i--;
base[0] = (unsigned char) i;
}
/* --------------------------------------------------------------------------------- */
short memcmpi( const void * buf1, const void * buf2, long len )
{
unsigned char * b1 = (unsigned char *) buf1;
unsigned char * b2 = (unsigned char *) buf2;
short c1, c2, diff;
for (; len>0L; len--, b1++, b2++)
{
c1 = TOUPPER( *b1 );
c2 = TOUPPER( *b2 );
diff = c1 - c2;
if (diff)
return diff;
}
return 0;
}